package andy.ham;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;



public class login_register extends Activity {
    private EditText id;
    private EditText password;
    private Button login;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.login);


        final EditText id = (EditText) findViewById(R.id.editText1);
        final EditText password = (EditText) findViewById(R.id.editText2);
        Button login = (Button) findViewById(R.id.button2);
        login.setOnClickListener(new Button.OnClickListener(){
            @Override
            public void onClick(View v) {
                String idNum = id.getText().toString();
                String pwd = password.getText().toString();
                String id = "陈博群";
                String password = "123456";
                if (idNum.equals(id)){
                    if(pwd.equals(password)) {
                        Intent intent = new Intent(login_register.this, LifeDiary.class);
                        startActivity(intent);
                        login_register.this.finish();
                    }else{
                        Toast.makeText(login_register.this,"密码不正确!提示：1-6",Toast.LENGTH_SHORT).show();
                    }
                }else {
                    Toast.makeText(login_register.this,"账号不正确!",Toast.LENGTH_SHORT).show();
                }

            }
        });
    }

}
